package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TableTimeCardRuleMapper;
import com.ruoyi.system.domain.TableTimeCardRule;
import com.ruoyi.system.service.ITableTimeCardRuleService;

/**
 * 桌台时长卡规则 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-22
 */
@Service
public class TableTimeCardRuleServiceImpl implements ITableTimeCardRuleService
{
    @Autowired
    private TableTimeCardRuleMapper tableTimeCardRuleMapper;

    /**
     * 通过id查询桌台时长卡规则
     *
     * @param id 桌台时长卡规则主键
     * @return 桌台时长卡规则
     */
    @Override
    public TableTimeCardRule selectTableTimeCardRuleById(Long id)
    {
        return tableTimeCardRuleMapper.selectTableTimeCardRuleById(id);
    }

    /**
     * 通过门店名称查询桌台时长卡规则列表
     *
     * @param storeName 门店名称
     * @return 桌台时长卡规则
     */
    @Override
    public List<TableTimeCardRule> selectTableTimeCardRuleListByName(String storeName)
    {
        return tableTimeCardRuleMapper.selectTableTimeCardRuleListByName(storeName);
    }

    /**
     * 新增桌台时长卡规则
     *
     * @param tableTimeCardRule 桌台时长卡规则
     * @return 结果
     */
    @Override
    public int insertTableTimeCardRule(TableTimeCardRule tableTimeCardRule)
    {
        tableTimeCardRule.setCreateTime(DateUtils.getNowDate());
        return tableTimeCardRuleMapper.insertTableTimeCardRule(tableTimeCardRule);
    }

    /**
     * 修改桌台时长卡规则
     *
     * @param tableTimeCardRule 桌台时长卡规则
     * @return 结果
     */
    @Override
    public int updateTableTimeCardRule(TableTimeCardRule tableTimeCardRule)
    {
        tableTimeCardRule.setUpdateTime(DateUtils.getNowDate());
        return tableTimeCardRuleMapper.updateTableTimeCardRule(tableTimeCardRule);
    }

    /**
     * 通过id批量删除桌台时长卡规则信息
     *
     * @param ids 需要删除的桌台时长卡规则主键
     * @return 结果
     */
    @Override
    public int deleteTableTimeCardRuleByIds(Long[] ids)
    {
        return tableTimeCardRuleMapper.deleteTableTimeCardRuleByIds(ids);
    }

    /**
     * 通过id删除桌台时长卡规则信息
     *
     * @param id 桌台时长卡规则主键
     * @return 结果
     */
    @Override
    public int deleteTableTimeCardRuleById(Long id)
    {
        return tableTimeCardRuleMapper.deleteTableTimeCardRuleById(id);
    }
}
